wayland: Perform seat grab focus checks on native windows
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 27 Apr 2016 10:12:18 +0000 (12:12 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 27 Apr 2016 11:29:19 +0000 (13:29 +0200)
We don't care about the specific (possibly client-side) window that
requested the focus here, only the toplevel. Fixes mistakenly sent
focus events when the grab happens inside the current focus window.

https://bugzilla.gnome.org/show_bug.cgi?id=762756

gdk/wayland/gdkdevice-wayland.c

index e3f7fac7e244b527663a88a3efc60090752ac086..8d0a61e0997ca932d01cd5b68a2a0ed0adae20a5 100644 (file)
@@ -3722,7 +3722,7 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
   if (native == NULL || GDK_WINDOW_DESTROYED (native))
     return GDK_GRAB_NOT_VIEWABLE;
 
-  gdk_wayland_seat_set_grab_window (wayland_seat, window);
+  gdk_wayland_seat_set_grab_window (wayland_seat, native);
   wayland_seat->grab_time = evtime;
 
   if (prepare_func)
@@ -3741,9 +3741,9 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
     {
       GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_pointer);
 
-      if (prev_focus != window)
+      if (prev_focus != native)
         device_emit_grab_crossing (wayland_seat->master_pointer, prev_focus,
-                                   window, GDK_CROSSING_GRAB, evtime);
+                                   native, GDK_CROSSING_GRAB, evtime);
 
       _gdk_display_add_device_grab (display,
                                     wayland_seat->master_pointer,
@@ -3766,9 +3766,9 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
     {
       GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->touch_master);
 
-      if (prev_focus != window)
+      if (prev_focus != native)
         device_emit_grab_crossing (wayland_seat->touch_master, prev_focus,
-                                   window, GDK_CROSSING_GRAB, evtime);
+                                   native, GDK_CROSSING_GRAB, evtime);
 
       _gdk_display_add_device_grab (display,
                                     wayland_seat->touch_master,
@@ -3787,9 +3787,9 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
     {
       GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_keyboard);
 
-      if (prev_focus != window)
+      if (prev_focus != native)
         device_emit_grab_crossing (wayland_seat->master_keyboard, prev_focus,
-                                   window, GDK_CROSSING_GRAB, evtime);
+                                   native, GDK_CROSSING_GRAB, evtime);
 
       _gdk_display_add_device_grab (display,
                                     wayland_seat->master_keyboard,
@@ -3811,9 +3811,9 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
           GdkWaylandTabletData *tablet = l->data;
           GdkWindow *prev_focus = gdk_wayland_device_get_focus (tablet->master);
 
-          if (prev_focus != window)
+          if (prev_focus != native)
             device_emit_grab_crossing (tablet->master, prev_focus,
-                                       window, GDK_CROSSING_GRAB, evtime);
+                                       native, GDK_CROSSING_GRAB, evtime);
 
           _gdk_display_add_device_grab (display,
                                         tablet->master,